load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "kvstreamer",
    srcs = [
        "avg_response_estimator.go",
        "budget.go",
        "requests_provider.go",
        "results_buffer.go",
        "size.go",
        "streamer.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/kv/kvclient/kvstreamer",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/keys",
        "//pkg/kv",
        "//pkg/kv/kvclient/kvcoord",
        "//pkg/kv/kvpb",
        "//pkg/kv/kvserver/concurrency/lock",
        "//pkg/kv/kvserver/diskmap",
        "//pkg/roachpb",
        "//pkg/settings",
        "//pkg/settings/cluster",
        "//pkg/sql/sessiondata",
        "//pkg/util",
        "//pkg/util/admission",
        "//pkg/util/admission/admissionpb",
        "//pkg/util/bitmap",
        "//pkg/util/buildutil",
        "//pkg/util/humanizeutil",
        "//pkg/util/log",
        "//pkg/util/mon",
        "//pkg/util/quotapool",
        "//pkg/util/stop",
        "//pkg/util/syncutil",
        "@com_github_cockroachdb_errors//:errors",
    ],
)

go_test(
    name = "kvstreamer_test",
    srcs = [
        "avg_response_estimator_test.go",
        "inject_setup_test.go",
        "large_keys_test.go",
        "main_test.go",
        "requests_provider_test.go",
        "results_buffer_test.go",
        "streamer_accounting_test.go",
        "streamer_disabled_test.go",
        "streamer_test.go",
    ],
    embed = [":kvstreamer"],
    exec_properties = select({
        "//build/toolchains:is_heavy": {"test.Pool": "heavy"},
        "//conditions:default": {"test.Pool": "large"},
    }),
    deps = [
        "//pkg/base",
        "//pkg/keys",
        "//pkg/kv",
        "//pkg/kv/kvclient/kvcoord",
        "//pkg/kv/kvpb",
        "//pkg/kv/kvserver/concurrency/lock",
        "//pkg/roachpb",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/server",
        "//pkg/settings/cluster",
        "//pkg/sql",
        "//pkg/sql/rowcontainer",
        "//pkg/sql/sem/eval",
        "//pkg/storage",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/skip",
        "//pkg/testutils/sqlutils",
        "//pkg/util/hlc",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/mon",
        "//pkg/util/randutil",
        "//pkg/util/tracing/tracingpb",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_dustin_go_humanize//:go-humanize",
        "@com_github_stretchr_testify//require",
    ],
)
